package com.aaa.service.mht.impl;


import com.aaa.dao.mht.TMhtPlaneMapper;
import com.aaa.entity.MyPage;
import com.aaa.entity.mht.TMhtPlane;
import com.aaa.service.mht.TMhtPlaneService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class TMhtPlaneServiceImpl implements TMhtPlaneService {
   @Autowired
   private TMhtPlaneMapper tMhtPlaneMapper;

   @Override
   public PageInfo queryAll(MyPage myPage, TMhtPlane tMhtPlane) {
      PageHelper.startPage(myPage.getPage(),myPage.getLimit());

      return new PageInfo(tMhtPlaneMapper.selectAllData(tMhtPlane));
   }

    @Override
    public boolean selectPlane(TMhtPlane plane) {
        List<TMhtPlane> select = tMhtPlaneMapper.select(plane);
        return select.size()==0;
    }

    @Override
    public boolean insertPlane(TMhtPlane plane) {

       return tMhtPlaneMapper.insert(plane)>0;
    }

    @Override
    public boolean updatePlane(TMhtPlane plane) {
        return tMhtPlaneMapper.updateByPrimaryKeySelective(plane)>0;
    }

    @Override
    public TMhtPlane queryByQyCode(TMhtPlane tMhtPlane) {

        TMhtPlane tMhtPlane1 = tMhtPlaneMapper.selectOne(tMhtPlane);

        return tMhtPlane1;
    }
}

